#pragma once
#include <string>
#include <memory>
#include <map>
#include <thread>
#include <mutex>
#include "LocationInfo.h"
namespace Planner
{
class ObstacleManage
{
    public:
        ObstacleManage(const ObstacleManage&)=delete;
        ObstacleManage& operator=(const ObstacleManage&)=delete;
        static std::shared_ptr<ObstacleManage> getInstance();
        void addObstacle(int id,const LocationInfo& temp);
        void addTarget(int id,const LocationInfo& temp);
        const std::map<int,LocationInfo> getObstacleMap(){ std::lock_guard<std::mutex>slok(_thread_mutex);  return _obstacle_map;}
    private:
        ObstacleManage();
        void obstacleManageThread();
        std::map<int,LocationInfo> _obstacle_map;
        std::map<int,LocationInfo> _target_map;
        std::shared_ptr<std::thread> _obs_thread;
        std::mutex _thread_mutex;
        static std::shared_ptr<ObstacleManage>  _singleton;
};
};